// @APIVersion 1.0.0
// @Title beego Test API
// @Description beego has a very cool tools to autogenerate documents for your API
// @Contact astaxie@gmail.com
// @TermsOfServiceUrl http://beego.me/
// @License Apache 2.0
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
package routers

import (
	"lao-a/controllers"
	"lao-a/controllers/activity"
	"lao-a/controllers/appindex"
	"lao-a/controllers/member"
	"lao-a/controllers/user"

	"github.com/astaxie/beego"
)

func init() {
	authApiPrefix := beego.AppConfig.String("AuthApiPrefix")

	ns1 := beego.NewNamespace(authApiPrefix,
		beego.NSRouter("/user", &user.UserController{}, "get:GetUser"),
		// beego.NSRouter("/user", &user.UserController{}, "put:UpdateUser"),
		beego.NSRouter("/password", &user.UserController{}, "put:UpdatePassword"),
		beego.NSRouter("/signout", &user.UserController{}, "get:SignOut"),

		beego.NSRouter("/cardnum", &member.MemberController{}, "post:NewCardNum"),
		beego.NSRouter("/image", &controllers.FileController{}, "post:UploadImage"),

		beego.NSRouter("/dict/activity/type", &activity.ActivityController{}, "get:GetActivityTypes"),
		beego.NSRouter("/dict/member/type", &member.MemberController{}, "get:GetMemberTypes"),
		beego.NSRouter("/dict/member/level", &member.MemberController{}, "get:GetMemberLevels"),

		beego.NSRouter("/member", &member.MemberController{}, "get:List"),
		beego.NSRouter("/member", &member.MemberController{}, "post:Save"),
		beego.NSRouter("/member/:memId", &member.MemberController{}, "get:Get"),
		beego.NSRouter("/member/:memId", &member.MemberController{}, "put:Update"),

		beego.NSRouter("/activity", &activity.ActivityController{}, "get:ActivityList"),
		beego.NSRouter("/activity", &activity.ActivityController{}, "post:SaveActivity"),
		beego.NSRouter("/activity/:actId([0-9]+)", &activity.ActivityController{}, "get:GetActivity"),
		beego.NSRouter("/activity/:actId([0-9]+)", &activity.ActivityController{}, "put:UpdateActivity"),

		beego.NSRouter("/activity/:actId([0-9]+)/apply", &activity.ActivityController{}, "post:SaveActivityMember"),
		beego.NSRouter("/activity/:actId([0-9]+)/apply/:applyId([0-9]+)", &activity.ActivityController{}, "get:GetActivityMember"),
		beego.NSRouter("/activity/:actId([0-9]+)/apply/:applyId([0-9]+)/status/:sts([0-9]+)", &activity.ActivityController{}, "put:UpdateActivityStatus"),
		beego.NSRouter("/activity/:actId([0-9]+)/apply/:applyId([0-9]+)/member/:memId([0-9]+)", &activity.ActivityController{}, "put:UpdateActivityMemID"),
	)
	beego.AddNamespace(ns1)

	commApiPrefix := beego.AppConfig.String("CommonApiPrefix")
	ns2 := beego.NewNamespace(commApiPrefix,
		beego.NSRouter("/dict/activity/type", &activity.ActivityController{}, "get:GetActivityTypes"),
		beego.NSRouter("/dict/member/type", &member.MemberController{}, "get:GetMemberTypes"),
		beego.NSRouter("/dict/member/level", &member.MemberController{}, "get:GetMemberLevels"),

		beego.NSRouter("/app/index", &appindex.WechatIndexController{}, "get:Index"),

		beego.NSRouter("/signin", &user.UserController{}, "get:Login"),

		beego.NSRouter("/activity", &activity.ActivityController{}, "get:ActivityList"),
		beego.NSRouter("/activity/:actId([0-9]+)", &activity.ActivityController{}, "get:GetActivity"),
		beego.NSRouter("/activity/:actId([0-9]+)/join", &activity.ActivityController{}, "get:GetActivity"),

		beego.NSRouter("/member/join", &member.MemberController{}, "post:Join"),
		beego.NSRouter("/member/mine", &member.MemberController{}, "get:Current"),
		beego.NSRouter("/member/mine", &member.MemberController{}, "post:EditCurrent"),
	)
	beego.AddNamespace(ns2)

}
